package com.up.blog.service;

import com.up.blog.domain.Admin;
import com.up.blog.mapper.LoginCheckMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.io.IOException;
import java.sql.SQLException;
@Service("loginCheckService")
public class LoginCheckService {
    @Autowired
    private LoginCheckMapper mapper;
    public String login(String name,String password) throws SQLException, IOException {
//        InputStream conf = Resources.getResourceAsStream("SqlMapConfig.xml");
//        //创建会话工厂
//        SqlSessionFactory sqlSessionFactory = new SqlSessionFactoryBuilder().build(conf);
//        //使用会话工厂创建会话对象
//        SqlSession sqlSession = sqlSessionFactory.openSession(true);
//        LoginCheckMapper mapper = sqlSession.getMapper(LoginCheckMapper.class);

        Admin admin = new Admin();
        admin.setRname(name);
        admin.setRpassword(password);
        String img = mapper.login(admin);
        return img;
    }
}
